home *** CD-ROM | disk | FTP | other *** search
-
-
-
- SSSSEEEELLLLEEEECCCCTTTT((((2222)))) SSSSEEEELLLLEEEECCCCTTTT((((2222))))
-
-
-
- NNNNAAAAMMMMEEEE
- select - synchronous I/O multiplexing
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<uuuunnnniiiissssttttdddd....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttyyyyppppeeeessss....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<bbbbssssttttrrrriiiinnnngggg....hhhh>>>>
- ####iiiinnnncccclllluuuuddddeeee <<<<ssssyyyyssss////ttttiiiimmmmeeee....hhhh>>>>
-
- iiiinnnntttt sssseeeelllleeeecccctttt ((((iiiinnnntttt nnnnffffddddssss,,,, ffffdddd____sssseeeetttt ****rrrreeeeaaaaddddffffddddssss,,,, ffffdddd____sssseeeetttt ****wwwwrrrriiiitttteeeeffffddddssss,,,,
- ffffdddd____sssseeeetttt ****eeeexxxxcccceeeeppppttttffffddddssss,,,, ssssttttrrrruuuucccctttt ttttiiiimmmmeeeevvvvaaaallll ****ttttiiiimmmmeeeeoooouuuutttt))));;;;
-
- FFFFDDDD____SSSSEEEETTTT((((ffffdddd,,,, &&&&ffffddddsssseeeetttt))))
- FFFFDDDD____CCCCLLLLRRRR((((ffffdddd,,,, &&&&ffffddddsssseeeetttt))))
- FFFFDDDD____IIIISSSSSSSSEEEETTTT((((ffffdddd,,,, &&&&ffffddddsssseeeetttt))))
- FFFFDDDD____ZZZZEEEERRRROOOO((((&&&&ffffddddsssseeeetttt))))
- iiiinnnntttt ffffdddd;;;;
- ffffdddd____sssseeeetttt ffffddddsssseeeetttt;;;;
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- _S_e_l_e_c_t examines the I/O descriptor sets whose addresses are passed in
- _r_e_a_d_f_d_s, _w_r_i_t_e_f_d_s, and _e_x_c_e_p_t_f_d_s to see if some of their descriptors are
- ready for reading, are ready for writing, or have an exceptional
- condition pending, respectively. The first _n_f_d_s file descriptors are
- checked in each set; i.e. the file descriptors from 0 through _n_f_d_s - 1
- will be examined (see _gggg_eeee_tttt_dddd_tttt_aaaa_bbbb_llll_eeee_hhhh_iiii(3) for largest open descriptor). On
- return, _s_e_l_e_c_t replaces the given descriptor sets with subsets consisting
- of those descriptors that are ready for the requested operation. The
- total number of ready descriptors in all the sets is the return value.
-
- The descriptor sets are stored as bit fields in arrays of integers. The
- following macros are provided for manipulating such descriptor sets:
- _F_D__Z_E_R_O(&_f_d_s_e_t) initializes a descriptor set _f_d_s_e_t to the null set.
- _F_D__S_E_T(_f_d, &_f_d_s_e_t) includes a particular descriptor _f_d in _f_d_s_e_t.
- _F_D__C_L_R(_f_d, &_f_d_s_e_t) removes _f_d from _f_d_s_e_t. _F_D__I_S_S_E_T(_f_d, &_f_d_s_e_t) is
- nonzero if _f_d is a member of _f_d_s_e_t, zero otherwise. The behavior of
- these macros is undefined if a descriptor value is less than zero or
- greater than or equal to _F_D__S_E_T_S_I_Z_E, which is normally at least equal to
- the maximum number of descriptors supported by the system.
-
- If _t_i_m_e_o_u_t is a non-zero pointer, it specifies a maximum interval to wait
- for the selection to complete. If _t_i_m_e_o_u_t is a zero pointer, the select
- blocks indefinitely. To effect a poll, the _t_i_m_e_o_u_t argument should be
- non-zero, pointing to a zero-valued timeval structure.
-
- Any of _r_e_a_d_f_d_s, _w_r_i_t_e_f_d_s, and _e_x_c_e_p_t_f_d_s may be given as zero pointers if
- no descriptors are of interest.
-
- RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
- _S_e_l_e_c_t returns the number of ready descriptors that are contained in the
- descriptor sets, or -1 if an error occurred. If the time limit expires
- then _s_e_l_e_c_t returns 0. If _s_e_l_e_c_t returns with an error, including one
-
-
-
- PPPPaaaaggggeeee 1111
-
-
-
-
-
-
- SSSSEEEELLLLEEEECCCCTTTT((((2222)))) SSSSEEEELLLLEEEECCCCTTTT((((2222))))
-
-
-
- due to an interrupted call, the descriptor sets will be unmodified.
-
- EEEERRRRRRRROOOORRRRSSSS
- An error return from _s_e_l_e_c_t indicates:
-
- [EBADF] One of the descriptor sets specified an invalid
- descriptor.
-
- [EINTR] A signal was delivered before the time limit expired and
- before any of the selected events occurred.
-
- [EINVAL] The specified time limit is invalid. One of its
- components is negative or too large.
-
- SSSSEEEEEEEE AAAALLLLSSSSOOOO
- poll(2), accept(2), connect(2), read(2), write(2), recv(2), send(2),
- getdtablehi(3C).
-
- NNNNOOOOTTTTEEEESSSS
- Some devices do not support polling via the _s_e_l_e_c_t(2) and _p_o_l_l(2) system
- calls. Doing a _s_e_l_e_c_t or _p_o_l_l on a file descriptor associated with an
- "un-pollable" device will cause the _s_e_l_e_c_t or _p_o_l_l to return immediately
- with a success value of 0 and the with the corresponding file descriptor
- events of queried set true. For instance, if a _s_e_l_e_c_t or _p_o_l_l is
- performed on a read file descriptor associated with an un-pollable
- device, the call would return immediately, even though there may be
- nothing to read on the device. A subsequent _r_e_a_d(2) in this situation
- might return with a "bytes-read" count of 0 or might block if the device
- supports read blocking. Devices which exhibit this behavior (especially
- those from third-party vendors) should be suspected as not supporting
- polling.
-
- BBBBUUUUGGGGSSSS
- _S_e_l_e_c_t should probably return the time remaining from the original
- timeout, if any, by modifying the time value in place. This may be
- implemented in future versions of the system. Thus, it is unwise to
- assume that the timeout value will be unmodified by the _s_e_l_e_c_t call.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- PPPPaaaaggggeeee 2222
-
-
-
-